<template>
  <router-view />
</template>
<script>
import router from "./router";

export default {
  created() {
    var baseUrl = location.pathname;
    this.$store.dispatch("asyncRouter").then((res) => {
      router.addRoutes(res);
      this.$router.push(baseUrl);
    }); //动态路由
  },
  mounted() {
    this.$nextTick(() => {
      setTimeout(() => {
        var data = {
          openKeys: this.$route.meta && this.$route.meta.pname,
          defaultSelectedKeys: this.$route.name,
        };
        this.$store.commit("setSelectedKeys", data);
      }, 1000);
    });
  },
};
</script>
<style lang="less">
@import "./app.less";
.ant-menu-submenu-inline {
  a {
    color: #fff;
  }
}
.ant-menu-submenu-open {
  a {
    color: #1890ff;
  }
}
</style>